package com.dyh.quickdemo.msk;

import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.javassist.runtime.Inner;
import org.junit.jupiter.api.Test;

import java.util.Date;
import java.util.Properties;
import java.util.function.Function;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertEquals;

/*
@Author=Joey Wheeler
@Date=2021/3/13 14:21
*/
public class M {


    @Test
    public void test7(){

    }

    public static  <T,R> Function<T,R> quickRet(Function<T,R> raw){
        return t->{
            return raw.apply(t);
        };
    }

    class Inner{
        long longData;

        public long getLongData() {
            return longData;
        }

        public void setLongData(long longData) {
            this.longData = longData;
        }
    }

    @Test
    public void test4(){
        Inner inner  = new Inner();
        System.out.println(inner.getLongData());
        System.out.println(inner.getLongData()==0);
        System.out.println(inner.getLongData()==0L);
        System.out.println(new Date(0L));
    }

    @Test
    public void test3(){
//        JSONObject jsonObject = null;
         JSONObject jsonObject = new JSONObject();
        jsonObject.put("name","van");

        String res = Stream.of( jsonObject).findFirst().map(e->e.getString("name")).orElse("");

        System.out.println(res);


    }


    @Test
    public void test2(){
        int count = Stream.of( 1, 2, 3) .reduce( 0, (acc, element) -> acc + element);

        System.out.println(count);
        assertEquals( 6,count);

    }


    @Test
    public void test1(){
        Properties properties = new Properties();
        properties.setProperty("name","dawd");

        System.out.println(properties);
        System.out.println(properties.getProperty("name"));
    }
    @Test
    public void test(){
        int SET_BITS1 = 0b01;
        int SET_BITS2 = 0b10;
        System.out.println(SET_BITS1);//1
        System.out.println(SET_BITS2);//2

        System.out.println(SET_BITS1 | SET_BITS2);//3
    }

    @Test
    public void test5(){
        String res = "XS012103C000P2-1";

        System.out.println(res.length());
    }


//    public static createMask(){
//        for (TypeEnum value : TypeEnum.values()) {
//
//        }
//    }
}
